package com.pearadmin.hospital.service.impl;

import java.util.List;
import java.util.ArrayList;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pearadmin.common.web.domain.request.PageDomain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pearadmin.hospital.mapper.HospitalSaleinfoMapper;
import com.pearadmin.hospital.domain.HospitalSaleinfo;
import com.pearadmin.hospital.service.IHospitalSaleinfoService;

/**
 * 销售记录Service业务层处理
 * 
 * @author yuan
 * @date 2021-07-29
 */
@Service
public class HospitalSaleinfoServiceImpl implements IHospitalSaleinfoService 
{
    @Autowired
    private HospitalSaleinfoMapper hospitalSaleinfoMapper;

    /**
     * 查询销售记录
     * 
     * @param id 销售记录ID
     * @return 销售记录
     */
    @Override
    public HospitalSaleinfo selectHospitalSaleinfoById(Integer id)
    {
        return hospitalSaleinfoMapper.selectHospitalSaleinfoById(id);
    }

    /**
     * 查询销售记录列表
     * 
     * @param hospitalSaleinfo 销售记录
     * @return 销售记录
     */
    @Override
    public List<HospitalSaleinfo> selectHospitalSaleinfoList(HospitalSaleinfo hospitalSaleinfo)
    {
        return hospitalSaleinfoMapper.selectHospitalSaleinfoList(hospitalSaleinfo);
    }

    /**
     * 查询销售记录
     * @param hospitalSaleinfo 销售记录
     * @param pageDomain
     * @return 销售记录 分页集合
     * */
    @Override
    public PageInfo<HospitalSaleinfo> selectHospitalSaleinfoPage(HospitalSaleinfo hospitalSaleinfo, PageDomain pageDomain)
    {
        PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit());
        List<HospitalSaleinfo> data = hospitalSaleinfoMapper.selectHospitalSaleinfoList(hospitalSaleinfo);
        return new PageInfo<>(data);
    }

    /**
     * 新增销售记录
     * 
     * @param hospitalSaleinfo 销售记录
     * @return 结果
     */

    @Override
    public int insertHospitalSaleinfo(HospitalSaleinfo hospitalSaleinfo)
    {
        return hospitalSaleinfoMapper.insertHospitalSaleinfo(hospitalSaleinfo);
    }

    /**
     * 修改销售记录
     * 
     * @param hospitalSaleinfo 销售记录
     * @return 结果
     */
    @Override
    public int updateHospitalSaleinfo(HospitalSaleinfo hospitalSaleinfo)
    {
        return hospitalSaleinfoMapper.updateHospitalSaleinfo(hospitalSaleinfo);
    }

    /**
     * 删除销售记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHospitalSaleinfoByIds(String[] ids)
    {
        return hospitalSaleinfoMapper.deleteHospitalSaleinfoByIds(ids);
    }

    /**
     * 删除销售记录信息
     * 
     * @param id 销售记录ID
     * @return 结果
     */
    @Override
    public int deleteHospitalSaleinfoById(Integer id)
    {
        return hospitalSaleinfoMapper.deleteHospitalSaleinfoById(id);
    }
}
